<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>存储过程 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="SQL Server" />
  
  
  
  
  <meta name="description" content="存储过程">
<meta name="keywords" content="SQL Server">
<meta property="og:type" content="article">
<meta property="og:title" content="存储过程">
<meta property="og:url" content="http://www.hais2.com/2015/03/26/Sql-Stored-procedure/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="存储过程">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2017-08-02T15:22:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="存储过程">
<meta name="twitter:description" content="存储过程">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Sql-Stored-procedure" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      存储过程
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2015/03/26/Sql-Stored-procedure/" class="article-date">
	  <time datetime="2015-03-26T03:25:35.000Z" itemprop="datePublished">March 26, 2015</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="什么是存储过程"><a href="#什么是存储过程" class="headerlink" title="什么是存储过程"></a>什么是存储过程</h2><p>　　调用<a href="http://baike.baidu.com/link?url=c2abUFqhD2LK7x4of_AqDRsR9zA_O8N7DSr-IK1oY_7C8_0OxNX-3mVmBfbPpYo5yhMm8nUGydsNQV0NJ73EL_" target="_blank" rel="noopener">百度百科</a>的解释:存储过程（Stored Procedure）是在大型数据库系统中，一组为了完成特定功能的SQL 语句集，存储在数据库中，经过第一次编译后再次调用不需要再次编译，用户通过指定存储过程的名字并给出参数（如果该存储过程带有参数）来执行它。存储过程是数据库中的一个重要对象，任何一个设计良好的数据库应用程序都应该用到存储过程。<br>　　简单来说，存储过程就像是c#中的<strong>方法</strong>，该方法实现某一特定的功能，在需要的地方直接调用就行了。而且该方法还是单例的。<br>　　存储过程不仅仅是一组SQL语句的组合，存储过程和一般的SQL语句还是有区别的。<br>　　<a id="more"></a><br>　　当我们使用SQL Server数据库帮助我们建立网站或应用软件时，Transaction-SQL是一种主要的编程语言，使用SQL语句(Transaction-SQL)编程有两种方法：<br>　　① 在本地存储SQL语句编写的代码，通过程序连接数据库，对SQL Server进行操作。<br>　　② 把部分复杂或重用的SQL语句封装成存储过程，存储在SQL Server数据库中，然后通过程序去调用存储过程即可。而且还可以在存储过程中调用另一个存储过程。</p>
<h3 id="存储过程的优点"><a href="#存储过程的优点" class="headerlink" title="存储过程的优点"></a>存储过程的优点</h3><p>　　1.存储过程只在创建时进行编译，以后每次执行都不需要重新编译，而一般SQL语句每执行一次就编译一次，所以存储过程可以提高数据库的执行速度。<br>　　2.对数据库进行复杂操作时(比如对多张表进行SELECT、INSERT、UPDATE、DELETE)，可将此复杂操作封装成存储过程，然后结合数据库中的事物处理一起使用。<br>　　3.存储过程可以复用，从而减少开发人员的工作量。<br>　　4.安全性高，可以设定操作此存储过程的用户权限。<br>　　5.使用时只需要传输调用语句，而非多条SQL语句，减少网络流量，降低网络负载。</p>
<h3 id="存储过程的种类"><a href="#存储过程的种类" class="headerlink" title="存储过程的种类"></a>存储过程的种类</h3><p>　　1.系统存储过程：以<code>SP_</code>开头，用来进行系统的各项设定、取得信息、相关管理，比如<code>SP_help</code>就是取得指定对象的相关信息。<br>　　2.扩展存储过程：以<code>XP_</code>开头，用来调用操作系统提供的功能，<code>exec master ..XP_cmdshell &#39;ping 120.110.119:12306&#39;</code><br>　　3.用户自定的存储过程，也就是这篇博客所说的存储过程。</p>
<h2 id="创建存储过程"><a href="#创建存储过程" class="headerlink" title="创建存储过程"></a>创建存储过程</h2><p>创建语法：<br>　　create proc usp_name<br>　　形参列表(形参名称以@符号开头，参数类型在后)<br>　　as<br>　　  方法体<br>　　go</p>
<p>调用语法：<br>　　exec 存储过程名称 实参,实参,实参…</p>
<p>　　<text style="color:red">在调用的时候要三个对应：类型对应、数量对应、顺序对应。<text></text></text></p>
<h3 id="代码示例："><a href="#代码示例：" class="headerlink" title="代码示例："></a>代码示例：</h3><p><strong>获取所有员工信息</strong><br><figure class="highlight oxygene"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">go</span><br><span class="line"><span class="keyword">if</span> exists(<span class="keyword">select</span> * <span class="keyword">from</span> sysobjects <span class="keyword">where</span> name=<span class="string">'usp_getAllStaffInfo'</span>)</span><br><span class="line">    drop proc usp_getAllStaffInfo</span><br><span class="line">go</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> <span class="function"><span class="keyword">procedure</span> <span class="title">usp_getAllStuInfo</span></span></span><br><span class="line"><span class="function"><span class="title">as</span></span></span><br><span class="line"><span class="function">    <span class="title">select</span> * <span class="title">from</span> <span class="title">Staff</span></span></span><br><span class="line"><span class="function"><span class="title">go</span></span></span><br><span class="line"><span class="function"></span></span><br><span class="line"><span class="function">--调用存储过程</span></span><br><span class="line"><span class="function"><span class="title">execute</span> <span class="title">usp_getAllStaffInfo</span></span></span><br></pre></td></tr></table></figure></p>
<p><strong>查询指定性别的员工信息</strong><br><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">go</span><br><span class="line">if exists(<span class="keyword">select</span> * <span class="keyword">from</span> sysobjects <span class="keyword">where</span> <span class="keyword">name</span>=<span class="string">'usp_GetStaffInfoBySex'</span>)</span><br><span class="line">    <span class="keyword">drop</span> proc usp_GetStaffInfoBySex</span><br><span class="line"><span class="keyword">go</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> PROC usp_GetStaffInfoBySex</span><br><span class="line">@sex <span class="keyword">nchar</span>(<span class="number">1</span>)   </span><br><span class="line"><span class="keyword">as</span></span><br><span class="line">    <span class="keyword">select</span> * <span class="keyword">from</span> Staff <span class="keyword">where</span> Sex=@sex</span><br><span class="line"><span class="keyword">go</span></span><br><span class="line"></span><br><span class="line"><span class="comment">--调用存储过程</span></span><br><span class="line">EXEC usp_GetStaffInfoBySex <span class="string">'男'</span></span><br></pre></td></tr></table></figure></p>
<p><strong>获取指定部门和性别的员工信息</strong><br><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">go</span><br><span class="line">if exists(<span class="keyword">select</span> * <span class="keyword">from</span> sysobjects <span class="keyword">where</span> <span class="keyword">name</span>=<span class="string">'usp_GetStaffInfoBySexForClass'</span>)</span><br><span class="line">    <span class="keyword">drop</span> PROC usp_GetStaffInfoBySexForClass</span><br><span class="line"><span class="keyword">go</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> PROC usp_GetStaffInfoBySexForClass</span><br><span class="line">@className <span class="keyword">nvarchar</span>(<span class="number">20</span>)</span><br><span class="line">@sex ncahr(<span class="number">1</span>)=<span class="string">'男'</span>   <span class="comment">--有默认值的形参</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line">    <span class="keyword">declare</span> @classId <span class="built_in">int</span>   <span class="comment">--声明一个存储部门ID的变量</span></span><br><span class="line">    <span class="keyword">set</span> @classId=(<span class="keyword">select</span> classId <span class="keyword">from</span> Company <span class="keyword">where</span> className=@className)</span><br><span class="line">    <span class="keyword">select</span> * <span class="keyword">from</span> Staff <span class="keyword">where</span> Sex=@sex <span class="keyword">and</span> classId=@classId</span><br><span class="line"><span class="keyword">go</span></span><br><span class="line"></span><br><span class="line"><span class="comment">--调用存储过程</span></span><br><span class="line">EXEC usp_GetStaffInfoBySexForClass @classId=<span class="string">'.NET部'</span>,@sex=<span class="string">'男'</span></span><br><span class="line">EXEC usp_GetStaffInfoBySexForClass <span class="string">'.NET部'</span>,<span class="string">'男'</span></span><br><span class="line">EXEC usp_GetStaffInfoBySexForClass <span class="keyword">default</span>,<span class="string">'.NET部'</span>    <span class="comment">--不需要改变默认值就是用default关键字</span></span><br></pre></td></tr></table></figure></p>
<p><strong>返回指定性别员工人数和总人数</strong><br>　　<code>output</code>参数相当于c#中的<code>out</code>参数，用于将参数返回，所以在调用的时候需要声明变量去接收。注意在接收的时候，接收的变量后也要有<code>output</code>参数。<br><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">go</span><br><span class="line">if exists(<span class="keyword">select</span> * <span class="keyword">from</span> sysobjects <span class="keyword">where</span> <span class="keyword">name</span>=<span class="string">'usp_GetStaffManAndStaffCount'</span>)</span><br><span class="line"><span class="keyword">create</span> proc usp_GetStaffManAndStaffCount</span><br><span class="line">    @sex <span class="keyword">nchar</span>(<span class="number">1</span>),</span><br><span class="line">    @SexCount <span class="built_in">int</span> <span class="keyword">output</span>,</span><br><span class="line">    @<span class="keyword">count</span> <span class="built_in">int</span> <span class="keyword">output</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line">    <span class="keyword">set</span> @SexCount=(<span class="keyword">select</span> <span class="keyword">count</span>(*) <span class="keyword">from</span> Staff <span class="keyword">where</span> Sex=@sex)</span><br><span class="line">    <span class="keyword">set</span> @<span class="keyword">count</span>=(<span class="keyword">select</span> <span class="keyword">count</span>(*) <span class="keyword">from</span> Staff)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">--调用存储过程</span></span><br><span class="line"><span class="keyword">declare</span> @manCount <span class="built_in">int</span>,@sumCount <span class="built_in">int</span></span><br><span class="line">exec usp_GetStaffManAndStaffCount <span class="string">'男'</span>,@manCount <span class="keyword">output</span>,@sumCount <span class="keyword">output</span></span><br></pre></td></tr></table></figure></p>
<p>🎫 <strong>一个分页存储过程</strong><br><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">if exists(<span class="keyword">select</span> * <span class="keyword">from</span> sysobjects <span class="keyword">where</span> <span class="keyword">name</span>=<span class="string">'usp_pageing'</span>)</span><br><span class="line">    <span class="keyword">drop</span> proc usp_pageing</span><br><span class="line"></span><br><span class="line"><span class="keyword">create</span> proc usp_pageing</span><br><span class="line">    @totalPage <span class="built_in">int</span> <span class="keyword">output</span>,   <span class="comment">--总页数</span></span><br><span class="line">    @pageIndex <span class="built_in">int</span>=<span class="number">1</span>,   <span class="comment">--当前的页码数，默认从1开始</span></span><br><span class="line">    @pageCount <span class="built_in">int</span>=<span class="number">10</span>   <span class="comment">--每页显示的条目数</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line">    <span class="keyword">select</span> * <span class="keyword">from</span> (<span class="keyword">select</span> ROW_NUMBER() <span class="keyword">over</span>(<span class="keyword">order</span> <span class="keyword">by</span> newsCreateDate) <span class="keyword">id</span>, * <span class="keyword">from</span> News) item <span class="keyword">where</span> item.Id&gt;(@pageIndex<span class="number">-1</span>)*@pageCount <span class="keyword">and</span> item.Id&lt;=(@pageIndex*@pageCount)</span><br><span class="line">    <span class="keyword">set</span> @totalPage=<span class="keyword">ceiling</span>((<span class="keyword">select</span> <span class="keyword">count</span>(*) <span class="keyword">from</span> News)*<span class="number">1.0</span>/@pageCount)   <span class="comment">--ceiling函数为向上四舍五入，如：ceiling(1.45,0) = 2;ceiling(1.55,0)=2</span></span><br></pre></td></tr></table></figure></p>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/SQL/">SQL</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SQL-Server/">SQL Server</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2015/04/01/SQL-Server-Transaction/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          SQL Server事务
        
      </div>
    </a>
  
  
    <a href="/2015/03/25/Added-the-database-search-statement-summary/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">数据库基本增删改查语句总结</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#什么是存储过程"><span class="nav-number">1.</span> <span class="nav-text">什么是存储过程</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#存储过程的优点"><span class="nav-number">1.1.</span> <span class="nav-text">存储过程的优点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#存储过程的种类"><span class="nav-number">1.2.</span> <span class="nav-text">存储过程的种类</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建存储过程"><span class="nav-number">2.</span> <span class="nav-text">创建存储过程</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#代码示例："><span class="nav-number">2.1.</span> <span class="nav-text">代码示例：</span></a></li></ol></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
